<?php
class Db{
	private static $INSTANCE;
	private $connection; 
	
	public static function getInstance() {
		if(self::$INSTANCE == null) {
			self::$INSTANCE = new Db();
		}
		return self::$INSTANCE;
	}
	
	public function getConnection() {
		if($this->connection == null) {
			
			$this->connection = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die("Couldn't connect to DB");
			if($this->connection == null) {
				//TODO: implement DBExcception class
				throw new Exception();
			}
		}
		return $this->connection;
	}
}
?>
